|
|
|
|
|
Bejegyzés nem található! |
|
function p228_googlemap(){
global $DB,$sdurl,$userinfo,$categoryid;
$pluginid = 228;
$icons=p228_geticons();
$l = GetLanguage(228);
$catid = $_GET['p228catid'] ? $_GET['p228catid'] : ($_POST['p228catid'] ? $_POST['p228catid'] : 'all');
$mid = $_GET['p228mid'] ? $_GET['p228mid'] : ($_POST['p228mid'] ? $_POST['p228mid'] : 'none');
$query = is_numeric($catid) ? 'm.catid='.$catid.' AND' : '';
$markersall = $DB->query("SELECT * FROM " . TABLE_PREFIX . "p228_markers as m LEFT JOIN " . TABLE_PREFIX . "p228_categories as c ON m.catid=c.catid WHERE $query m.online = '1' ORDER BY m.catid,m.mid");
while ($marker = $DB->fetch_array($markersall)) {$markers[]=$marker;}
$catsall = $DB->query("SELECT * FROM " . TABLE_PREFIX . "p228_categories ORDER BY catid");
while ($cats = $DB->fetch_array($catsall)) {$categories[]=$cats;}
$mainset = GetPluginSettings($pluginid,'Main Settings');
$mapset = GetPluginSettings($pluginid,'Map Settings');
$marset = GetPluginSettings($pluginid,'Marker Settings');
if(is_numeric($mid)) {
$miset = $DB->query_first("SELECT lat, lon, zoom FROM " . TABLE_PREFIX . "p228_markers WHERE mid = $mid");
$trigger = 'p228_go_to('.$miset['lat'].','.$miset['lon'].','.$miset['zoom'].','.$mid.');';
}
$maptype = $mapset['Default Map Type Control']=='standard' ? 'G_NORMAL_MAP' : ($mapset['Default Map Type Control']=='satellite' ? 'G_SATELLITE_MAP' : 'G_HYBRID_MAP');
$mapcontrol = $mapset['Map Controls']=='LargeMapControl' ? 'GLargeMapControl' : ($mapset['Map Controls']=='SmallMapControl' ? 'GSmallMapControl' : ($mapset['Map Controls']=='SmallZoomControl' ? 'GSmallZoomControl' : ( $mapset['Map Controls']=='ScaleControl' ? 'GScaleControl' : '' ) ) ) ;
echo '
'.($mapset['Search Control']==1?'
':'').'
';
echo '
|
|
';
}
function p228_googlemap_do($action) {
global $DB,$userinfo,$categoryid,$sdurl;
$pluginid = 228;
$p228_icons=p228_geticons();
$l = GetLanguage(228);
$mainset = GetPluginSettings($pluginid,'Main Settings');
$mset = GetPluginSettings($pluginid,'Map Settings');
if ($action=='add' OR $action=='edit') {
$maptype = $mset['Default Map Type Control']=='standard' ? 'G_NORMAL_MAP' : ($mset['Default Map Type Control']=='satellite' ? 'G_SATELLITE_MAP' : 'G_HYBRID_MAP');
$mapcontrol = $mset['Map Controls']=='LargeMapControl' ? 'GLargeMapControl' : ($mset['Map Controls']=='SmallMapControl' ? 'GSmallMapControl' : ($mset['Map Controls']=='SmallZoomControl' ? 'GSmallZoomControl' : ( $mset['Map Controls']=='ScaleControl' ? 'GScaleControl' : '' ) ) ) ;
$catsall = $DB->query("SELECT * FROM " . TABLE_PREFIX . "p228_categories ORDER BY catid");
while ($cats = $DB->fetch_array($catsall)) {$categories[]=$cats;}
if ($action=='edit') {
$mid = $_GET['p228mid'] ? $_GET['p228mid'] : ($_POST['p228mid'] ? $_POST['p228mid'] : 'none');
$marker = $DB->query_first("SELECT * FROM " . TABLE_PREFIX . "p228_markers as m LEFT JOIN " . TABLE_PREFIX . "p228_categories as c ON m.catid=c.catid WHERE m.online = '1' AND m.mid = $mid LIMIT 1");
if(@in_array(228, $userinfo['pluginadminids']) OR ($mainset['Allow Edit']=='1' AND $marker['username'] == $userinfo['username'])) {
$marker['cdate'] = date('Y-m-d H:i:s', $marker['cdate']);
$caption = $l['Edit Marker'];
$p228action='predit';
} else
{echo $l['You do not have permission to modify this entry.'];}
} else if ($action=='add') {
if(@in_array(228, $userinfo['pluginsubmitids']) OR @in_array(228, $userinfo['pluginadminids'])) {
$marker['lat']=$mset['Default latitude'];
$marker['lon']=$mset['Default longitude'];
$marker['zoom']=$mset['Default zoom'];
$marker['username']=$userinfo['username'];
$marker['cdate'] = date('Y-m-d H:i:s', time());
$dmset = GetPluginSettings($pluginid,'Marker');
$marker['dicon'] = $dmset['Default Marker'];
$marker['online'] = $mainset['Require Approval']=='1' ? '0' : '1';
$caption = $l['Add a New Marker'];
$p228action='pradd';
} else
{echo $l['You do not have permission to add an entry.'];}
}
//start
if(@in_array(228, $userinfo['pluginadminids']) OR ($action=='add' AND @in_array(228, $userinfo['pluginsubmitids'])) OR ( $action=='edit' AND $mainset['Allow Edit']=='1' AND $marker['username'] == $userinfo['username'])) {
echo '
'.($mset['Search Control']==1?'
':'').'
';
}
//end
} else if ($action=='pradd') {
if(!empty($_POST['title']) AND !empty($_POST['lat']) AND !empty($_POST['lon'])) {
$user = $_POST['user'] ? ( @in_array(228, $userinfo['pluginadminids']) ? $_POST['user'] : $userinfo['username'] ) : $userinfo['username'] ;
$_POST['online'] = @in_array(228, $userinfo['pluginadminids']) ? $_POST['online'] : ($mainset['Require Approval']=='1' ? '0' : '1');
$_POST['cdate'] = strtotime($_POST['cdate']);
$marset = GetPluginSettings($pluginid,'Marker Settings');
if(strlen($_POST['title']) <= $marset['Balloon Title'] AND strlen($_POST['descr']) <= $marset['Balloon Text']) {
if ($DB->query("INSERT INTO " . TABLE_PREFIX . "p228_markers (username, catid, title, lat, lon, zoom, descr, url, image, cdate, online) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",
$user,$_POST['cat'],$_POST['title'],$_POST['lat'],$_POST['lon'],$_POST['zoom'],$_POST['descr'],$_POST['url'],$_POST['image'],$_POST['cdate'],$_POST['online'])) {
$email = $mainset['Notification Email'];
if ($email AND strlen($email) > 0) {
//Start Email Notification
$emails = explode(" ", trim(eregi_replace("[[:space:]]+", " ", str_replace(',', ' ', $email))));
$subject = 'A New Marker was added to GooglMap Directory';
$message = "\"$userinfo[username]\" has added a new marker to the Map.\n";
$message .= "Title : $_POST[title]\n";
$message .= "Username : $user\n";
$message .= "Category ID: $_POST[catid]\n";
$message .= "Latitude: $_POST[lat]\n";
$message .= "Longitude: $_POST[lon]\n";
$message .= "Zoom: $_POST[zoom]\n";
$message .= "Description: $_POST[descr]\n";
$message .= "URL: $_POST[url]\n";
$message .= "Image URL: $_POST[image]\n";
$message .= "Creation Date: ".date('Y-m-d H:i:s', $_POST[cdate])."\n";
$message .= "Online Status: ".iif($_POST['online']=='0','Offline','Online')."\n";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: \"GoogleMap Directory\" <$email>\r\n";
$headers .= "Reply-To: \"GoogleMap Directory\" <$email>\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
for($i = 0; $i < count($emails); $i++)
{
@mail($emails[$i], $subject, $message, $headers);
}
//End Email Notification
}
echo $l['New Marker'].' "'.$_POST['title'].'" '.$l['was successfully submited.'];
} else
{
echo $l['Error : There was an error adding the record'];
}
}
else {
echo $l['Error : Title length should not exceed'].' '.$marset['Balloon Title'].' '.$l['& Description length should not exceed'].' '.$marset['Balloon Text'].'.';
}
} else {
echo $l['Error : Please fill all the required fields! (Title,Latitude,Longitude)'];
}
}
else if ($action=='predit') {
if(!empty($_POST['title']) AND !empty($_POST['lat']) AND !empty($_POST['lon'])) {
$user = $_POST['user'] ? ( @in_array(228, $userinfo['pluginadminids']) ? $_POST['user'] : $userinfo['username'] ) : $userinfo['username'] ;
$_POST['cdate'] = strtotime($_POST['cdate']);
$marset = GetPluginSettings($pluginid,'Marker Settings');
if(strlen($_POST['title']) <= $marset['Balloon Title'] AND strlen($_POST['descr']) <= $marset['Balloon Text']) {
if ($DB->query("UPDATE " . TABLE_PREFIX . "p228_markers SET username = '%s', catid = '%s', title = '%s', lat = '%s', lon = '%s', zoom = '%s', descr = '%s', url = '%s', image = '%s', cdate = '%s', online = '%s' WHERE mid = '%s'",
$user,$_POST['cat'],$_POST['title'],$_POST['lat'],$_POST['lon'],$_POST['zoom'],$_POST['descr'],$_POST['url'],$_POST['image'],$_POST['cdate'],$_POST['online'],$_POST['mid'])) {
echo $l['The Marker'].' "'.$_POST['title'].'" '.$l['was successfully saved.'];
} else
{
echo $l['Error : There was an error saving the record.'];
}
}
else {
echo $l['Error : Title length should not exceed'].' '.$marset['Balloon Title'].' '.$l['& Description length should not exceed'].' '.$marset['Balloon Text'].'.';
}
} else {
echo $l['Error : Please fill all the required fields! (Title,Latitude,Longitude)'];
}
}
}
function p228_geticons(){
global $DB;
$iconsdb = $DB->query("SELECT * FROM " . TABLE_PREFIX . "p228_icons ORDER BY iid");
while ($icons = $DB->fetch_array($iconsdb)) {
$id=$icons['iid'];
$icon[$id]=$icons;
}
return $icon;
}
$p228action = $_POST['p228action'] ? $_POST['p228action'] : ($_GET['p228action'] ? $_GET['p228action'] : 'none');
$p228actionarray = array('add','edit','pradd','predit');
if (in_array($p228action,$p228actionarray) ) { p228_googlemap_do($p228action); } else {
p228_googlemap();
}
?> |
|
|
|
|
|
|
|
|